Draft
fix(nfc): suppress OS NFC dispatch chooser during HCE sharing#3
Conversation
Copilot
AI
changed the title
fix(nfc): remove enableReaderMode that blocks HCE phone-to-phone sharing
fix(nfc): remove enableReaderMode that breaks HCE phone-to-phone sharing
Jul 5, 2026
Copilot
AI
changed the title
fix(nfc): remove enableReaderMode that breaks HCE phone-to-phone sharing
fix(nfc): suppress NFC tag dispatch while HCE is active to stop phone acting as reader
Jul 5, 2026
…suppress NDEF chooser
Copilot
AI
changed the title
fix(nfc): suppress NFC tag dispatch while HCE is active to stop phone acting as reader
fix(nfc): suppress OS NFC dispatch chooser during HCE sharing
Jul 5, 2026
|
✅ Debug APK artifact is ready for commit b64c0b3 . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When tapping to share via HCE, the sharing phone was simultaneously acting as an NFC reader — triggering an OS app-chooser dialog that blocked the share flow.
Root cause
enableForegroundDispatch(…, null, null)only intercepts theACTION_TAG_DISCOVEREDfallback tier. Any NFC-capable Android phone carries NDEF data, so Android evaluatesACTION_NDEF_DISCOVEREDfirst — which thenullfilters left unguarded — and dispatched it to all installed apps that handle that MIME type, producing a chooser.Fix
Pass explicit
IntentFilterarrays toenableForegroundDispatchcovering all three dispatch tiers:All three tiers now route to
ShareActivity.onNewIntentwhere they are silently discarded.enableForegroundDispatchis intentionally used overenableReaderMode, which per Android docs disables HCE/CE routing for its entire active duration.